package com.lagou;

import com.lagou.server.UserServerImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

/**
 * @author 陶肖寅
 * @version V1.0
 * @Package com.lagou
 * @email fromlx@126.com
 * @date 2020-03-23 23:32
 * @Copyright © 2020-2021 城云科技(中国)有限公司
 */
@SpringBootApplication
public class ServerBootstrap implements CommandLineRunner {
    public  static ApplicationContext applicationContext;
    @Autowired
    private UserServerImpl userServer;
    public static void main(String[] args) {
        applicationContext = SpringApplication.run(ServerBootstrap.class,args);
    }

    /**
     * 启动userServer类
     * @param args
     * @throws Exception
     */
    @Override
    public void run(String... args) throws Exception {
        try {
            userServer.startServer("127.0.0.1",8990);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
